import {ISwiperItem} from "@/components/ZJSwiper/types";
import ad1 from "@/assets/images/ad1.jpg";
import ad2 from "@/assets/images/ad2.jpg";
import ad3 from "@/assets/images/ad3.jpg";
import ad4 from "@/assets/images/ad4.jpg";

import kingkong1 from "@/assets/images/kingkong1.png"
import kingkong2 from "@/assets/images/kingkong2.png"
import kingkong3 from "@/assets/images/kingkong3.png"
import kingkong4 from "@/assets/images/kingkong4.png"
import kingkong5 from "@/assets/images/kingkong5.png"
import useGoodsModule from "@/store/goodsModule";

const goodsModule = useGoodsModule()
export const swiperItems: Array<ISwiperItem> = [
    {
        key: 1,
        imgUrl: ad1
    },
    {
        key: 2,
        imgUrl: ad2
    },
    {
        key: 3,
        imgUrl: ad3
    },
    {
        key: 4,
        imgUrl: ad4
    }
]
export const swiperConfig: any = {
    indicatorColor: "#C81C22"
}
export const kingKongSvgItems = [
    {
        key: 1,
        imgUrl: kingkong1,
        word: "大床"
    }, {
        key: 2,
        imgUrl: kingkong2,
        word: "餐桌"
    }, {
        key: 3,
        imgUrl: kingkong3,
        word: "橱柜"
    }, {
        key: 4,
        imgUrl: kingkong4,
        word: "沙发"
    }, {
        key: 5,
        imgUrl: kingkong5,
        word: "茶几"
    }
]
export const vipSvgItems = [
    {
        key: 1,
        imgUrl: kingkong1,
        mainTitle: "积分兑换",
        subTitle: "积分当钱花"
    },
    {
        key: 2,
        imgUrl: kingkong1,
        mainTitle: "会员尊享",
        subTitle: "会员专享价"
    },
    {
        key: 3,
        imgUrl: kingkong1,
        mainTitle: "以旧换新",
        subTitle: "爆款换购"
    },
]
export const rankInfo = async () => { // classifyInfo goodsList
    // 获取所有分类后，拿出前三个分类，然后再用这三个分类id请求五个商品
    const classificationList = await goodsModule.getClassificationAction()
    let max = 3
    if (classificationList) {
        if (classificationList.length < 3) {
            max = classificationList.length
        }
        const result = []
        for (let i = 0; i < max; i++) {
            const data = await goodsModule.getGoodsByClassifyAction({
                classifyId: classificationList[i].id
            })
            result.push({
                classifyInfo: {
                    id: classificationList[i].id,
                    name: classificationList[i].name
                },
                goodsList: data.list.length >= 5 ? data.list.slice(0, 5) : data.list.slice(0, 3)
            })
        }
        return result
    }
}
export const scrollWrapperInfo = ".home-main .scroll-wrapper"
